#include "board.h"
#include "ssd1327.h"
#include "ec11.h"
#include "led.h"
#include "dma.h"
#include "zf_tim.h"

#include "easy_ui.h"
#include "menu.h"

void While_Handle(void)
{
	static uint16 Count = 0;

	if (Counter.Main >= 500)
	{ // 运行频率检测
		DMA_printf("%ld,%d\n", Counter.Main, Count);
		Count = 0;
		Counter.Main = 0;
	}
	Count++;
	LED_SetColor(PINK);

	// u8g2_ClearBuffer(&u8g2);//很低占用
	// u8g2_SendBuffer(&u8g2);会随着spi的clk变化刷新率，8有20,4有30,2有40
	// Page_Process();//27
	EasyUI(10);//21
}

void main(void)
{
	// 主板和模块初始化
	Board_Init();
	// 没这句printf单片机会死机，血淋淋的教训，花了三个小时排查的
	DMA_printf("Initialization complete!");

	MenuInit();
	while (1)
	{
		if (Counter.MainSW == ENABLE)
		{
			Counter.MainSW = DISABLE;
			While_Handle();
		}
	}
}
